﻿<?php  
	header("Content-Type: text/html;charset=utf-8");
	$uploadDir = 'files/';
	$uid = $_REQUEST["uid"];
	$name = $uid."_".$_FILES['Filedata']['name'];
	
	error_log($name, $_SESSION['id']);
	$uploadFile = $uploadDir . corregirNombre($name);
	$isUploaded = move_uploaded_file($_FILES['Filedata']['tmp_name'], $uploadFile);
	
	function corregirNombre($strName) {
		$arrCaracteres1 = array("á", "é", "í", "ó", "ú", "Á", "É", "Í", "Ó", "Ú", "ñ", "Ñ");
		$arrCaracteres2 = array("a", "e", "i", "o", "u", "A", "E", "I", "O", "U", "n", "N");
		$strName = str_replace($arrCaracteres1, $arrCaracteres2, $strName);
		return $strName;
	}   
 ?>
